# -------------------------------------------------------------------------- #
# Copyright 2002-2023, OpenNebula Project, OpenNebula Systems                #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
# not use this file except in compliance with the License. You may obtain    #
# a copy of the License at                                                   #
#                                                                            #
# http://www.apache.org/licenses/LICENSE-2.0                                 #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an "AS IS" BASIS,          #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
#--------------------------------------------------------------------------- #

################################################################################
# Defaults
################################################################################

ruby '>=2.0.0', '<4'
source 'https://rubygems.org'
ruby_version = Gem::Version.new(RUBY_VERSION)
rubygems_version = Gem::Version.new(`gem -v`)

################################################################################
# Gems only in one ruby version
################################################################################

if ruby_version >= Gem::Version.new('2.4.0')
    gem 'xmlrpc'
end

if ruby_version < Gem::Version.new('2.1.0')
    gem 'scrub_rb'
end

if ruby_version >= Gem::Version.new('3.0.0')
    gem 'rexml'
end

gem 'async-io', '= 1.32.1'
gem 'console', '= 1.15.3'
gem 'etc'
gem 'rb-inotify'

################################################################################
# gems groups
################################################################################

if ruby_version < Gem::Version.new('2.1.0')
    nokogiri = '< 1.7'
elsif ruby_version < Gem::Version.new('2.3.0')
    nokogiri = '< 1.10'
end

ps = '< 3.0.0' if ruby_version < Gem::Version.new('2.1.0')

if ruby_version < Gem::Version.new('2.2.0')
    rack     = '< 2.0.0'
    minitest = '< 5.12.0'
    pg       = '< 1.2.0'
end

if ruby_version < Gem::Version.new('2.3.0')
    zendesk = '< 1.17.0'
    rq      = '< 1.0.0'
end

if ruby_version <= Gem::Version.new('2.0.0')
   gem 'multipart-post', '~> 2.1.0'
end

gem 'ffi-rzmq', '~> 2.0.7'
gem 'net-ldap'
gem 'nokogiri', nokogiri
gem 'public_suffix', ps

group :cli do
    gem 'gnuplot'
    gem 'highline', '~> 1.7'
    gem 'mysql2'
    gem 'pg', pg

    if ruby_version < Gem::Version.new('3.0.0')
        gem 'sqlite3', '<= 1.6.9'
    elsif rubygems_version < Gem::Version.new('3.3.21')
        gem 'sqlite3', '<= 1.7.3'
    else
        gem 'sqlite3'
    end
    gem 'mini_portile2'
    gem 'sequel'
end

group :onecfg, :cli do
    gem 'opennebula-augeas', '>= 0.6.6.pre'
end

group :onecfg, :cloud, :oneflow, :sunstone do
    gem 'json', '>= 2.0'
end

group :onecfg do
    gem 'git', '~> 1.5'
end

group :hybrid do
    gem 'aws-sdk-ec2', '>=1.151'
    gem 'aws-sdk-s3'
    gem 'aws-sdk-cloudwatch'
    gem 'azure_mgmt_compute'
    gem 'azure_mgmt_monitor'
    gem 'azure_mgmt_network'
    gem 'azure_mgmt_resources'
    gem 'azure_mgmt_storage'
    gem 'configparser'
end

group :packethost do
    gem 'minitest', minitest
    if ruby_version >= Gem::Version.new('2.3.0')
	    gem 'faraday_middleware', '~> 1.2.0'
    end
    gem 'activesupport', '~> 4.2'
    gem 'i18n', '~> 0.9'
end

group :cloud, :oneflow, :sunstone do
    gem 'rack', rack
    gem 'sinatra', '< 4.0.0'
end

group :cloud do
    gem 'thin'
    gem 'uuidtools'
    gem 'curb'
end

group :oneflow, :sunstone do
    gem 'ipaddress', '~> 0.8.3'
end

group :oneflow do
    gem 'treetop', '>= 1.6.3'
    gem 'parse-cron'
end

group :sunstone do
    if ruby_version >= Gem::Version.new('2.4.0')
        gem 'webauthn'
    end

    gem 'zendesk_api', zendesk
    gem 'rqrcode', rq
    gem 'memcache-client'
    gem 'dalli', '<3.0'  # https://github.com/OpenNebula/one/issues/5584
    gem 'rotp'
end

group :oca do
    gem 'ox'
end

group :vmware do
    gem 'addressable'

    if ruby_version >= Gem::Version.new('2.3.0')
        gem 'vsphere-automation-cis', '~> 0.4.6'
        gem 'vsphere-automation-vcenter', '~> 0.4.6'
    end

    if ruby_version >= Gem::Version.new('2.4.1')
        gem 'rbvmomi2', '~> 3.7.0'
    end
end

group :prometheus do
    gem 'prometheus-client'
end
